﻿#include "FinanceDialog.h"

FinanceDialog::FinanceDialog(QWidget *parent) : QDialog(parent) {
    setWindowTitle("添加收款");
    QVBoxLayout *mainLayout = new QVBoxLayout(this);


    setStyleSheet(
        "QLineEdit, QDateEdit {"
        "  font-size: 18px;"
        "  font-weight: bold;"
        "  border: 2px solid #E0E0E0;"
        "  border-radius: 20px;"
        "  padding: 10px;"
        "  color: black;"
        "}"
        "QPushButton {"
        "  font-size: 18px;"
        "  font-weight: bold;"
        "  border: 2px solid #E0E0E0;"
        "  border-radius: 20px;"
        "  padding: 10px;"
        "  background-color: #0093D1;"
        "  color: white;"
        "}"
        "QComboBox {"
        "  font-size: 18px;"
        "  font-weight: bold;"
        "  border: 2px solid #E0E0E0;"
        "  border-radius: 20px;"
        "  padding: 10px;"
        "  color: black;"
        "}"
    );

    // 对应订单编号
    mainLayout->addWidget(new QLabel("订单编号", this));
    idInput = new QLineEdit(this);
    mainLayout->addWidget(idInput);

    // 日期
    mainLayout->addWidget(new QLabel("选择日期", this));
    dateEdit = new QDateEdit(QDate::currentDate(), this);
    dateEdit->setDisplayFormat("yyyy-MM-dd");
    dateEdit->setCalendarPopup(true);
    mainLayout->addWidget(dateEdit);

    // 金额
    mainLayout->addWidget(new QLabel("金额", this));
    amountInput = new QLineEdit(this);
    mainLayout->addWidget(amountInput);

    // 创建和添加按钮
    QHBoxLayout *buttonLayout = new QHBoxLayout();
    okButton = new QPushButton("确认", this);
    okButton->setStyleSheet("background-color: #0093D1; color: white; font-size: 20px; font-weight: bold; padding: 10px;");
    cancelButton = new QPushButton("取消", this);
    cancelButton->setStyleSheet("background-color: #0093D1; color: white; font-size: 20px; font-weight: bold; padding: 10px;");
    buttonLayout->addWidget(okButton);
    buttonLayout->addWidget(cancelButton);
    mainLayout->addLayout(buttonLayout);

    connect(okButton, &QPushButton::clicked, this, &QDialog::accept);
    connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);

    setLayout(mainLayout);
}
